﻿

using System;
using System.Collections.Generic;
using System.Drawing;

namespace _11_自定义控件
{


    /// <summary>
    /// 轨迹形状-父类
    /// </summary>
    [Serializable]//可序列化声明(允许此类创建出来的对象从内存条保存到硬盘上)
    public abstract class Shape
    {
        /// <summary>
        /// 形状名字
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 形状的颜色
        /// </summary>
        public Color Color { get; set; }

        /// <summary>
        /// 轨迹坐标点集合
        /// </summary>
        public List<Point> TrajectoryPoint = new List<Point>();

        public Shape(string name, Color color)
        {
            Name = name;
            Color = color;
        }
        /// <summary>
        /// 将坐标点更新到TrajectoryPoint集合中
        /// </summary>
        /// <param name="currentPoint">四象限坐标系的坐标</param>
        public abstract void Upadate(Point currentPoint);

        /// <summary>
        /// 在画布上绘制对应的形状
        /// </summary>
        /// <param name="g"></param>
        public abstract void Draw(Graphics g);

        public override string ToString()
        {
            return Name;
        }

    }
}
